﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordParagraphs
    {
        public WordParagraph this[int index]
        {
            get { return new WordParagraph(_paragraphs[index]) { Document = Document }; }
        }

        public int Count
        {
            get { return _paragraphs.Count; }
        }

        private Paragraphs _paragraphs;

        public WordDocument Document
        {
            get;
            internal set;
        }

        internal WordParagraphs(Paragraphs paragraphs)
        {
            _paragraphs = paragraphs;
        }

        public WordParagraph Add(WordRange range = null)
        {
            object rangeArg = range != null ? range._range : Type.Missing;
            return new WordParagraph(_paragraphs.Add(ref rangeArg).Next()) { Document = Document };
        }
    }
}
